#include <stdio.h>
#include<string.h>
#include<assert.h>
char *my_strcpy(char *dest, const char *src)
{
    char *ret = dest;
    while (*dest++ = *src++)
        ;
    return ret;
}

int my_strcmp(const char *str1,const char *str2)
{
    assert(str1&&str2);
    while(*str1==*str2)
    {
        if(*str1=='\0')

            return 0;
        str1++;
        str2++;
    }

    /*if(*str1>*str2)

        return 1;

    else
        return -1;*/
        return *str1-*str2;

}
void my_memcpy(void *dest,void *src,size_t num)
{
    void *ret=dest;
    assert(dest&&src);
    while(num--)
    {
        *(char*)dest=*(char*)src;
        dest=(char*)dest+1;
        src=(char*)src+1;
    }
    return ret;
}
char *my_strstr(const char *str1,const char *str2)
{
    assert(str1&&str2);
    if(*str2=='\0')
    return str1;
    const char *s1=NULL;
    const char *s2=NULL;
    const char *cp=str1;
    while(*cp)
    {
        s1=cp;
        s2=str2;
        while(*s1!='\0'&&*s2!='\0'&&*s1==*s2)
        {
            s1++;
            s2++;
        }
        if(*s2=='\0')
            return (char*)cp;
        cp++;
    }
    return NULL;
}
void *my_memmove(void *dest,void *src,size_t num)
{
    void *ret=dest;//标记首地址
    if(dest<src)
    {
        while(num--)
        {
            *(char*)dest=*(char*)src;
            dest=(char*)dest+1;
            src=(char*)src+1;
        }
    }
    else
    {
        while(num--)
        {
            *((char*)dest+num)=*((char*)src+num);
        }
    }
}
int cmp(void *e1,void *e2)
{
    return (*(int*)e1-*(int*)e2);
}
int main()
{
    char s1[] ="yxlm@666.com";
    char sep[]="@.";
    my_memcpy(s1,sep,20);
    printf("%s",s1);
    return 0;
}